#include <iostream>
#include <functional>
using namespace std;

void selectSort(int *p,int n,function<int(int,int)> cmp)
{
    for (int i = 0; i < n-1; ++i) {
        for (int j = i+1; j < n; ++j) {
            if(cmp(p[i],p[j]))
            {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = std::move(tmp);
            }
        }
    }
}


int main()
{
    int arr[] = {1,3,5,7,9,2,4,6,8,10};
    selectSort(arr,sizeof(arr)/sizeof(*arr),[](int x,int y){
        return x<y;//直接在这里改就可以了
    });
    for(auto & i:arr)
    {
        cout<<i<<endl;
    }
    return 0;
}
